package com.csun.cmny.provider.dao;

import com.csun.cmny.provider.model.domain.UacGroupRoleMenu;
import com.csun.cmny.provider.model.domain.UacMenu;
import com.csun.cmny.provider.model.domain.UacRoleMenu;
import com.csun.cmny.provider.model.dto.group.GroupMenuQueryDto;
import com.csun.cmny.provider.model.dto.group.GroupRoleDto;
import com.csun.cmny.provider.model.vo.MenuVo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface UacGroupRoleMenuMapper extends Mapper<UacGroupRoleMenu> {

    /**
     * 批量添加机构角色菜单
     *
     * @param groupId         the group id
     * @param uacRoleMenuList the role menu list
     *
     * @return the int.
     */
    Integer batchSaveGroupRoleMenu(@Param("groupId") Long groupId,
                                   @Param("uacRoleMenuList") List<UacRoleMenu> uacRoleMenuList);

    /**
     * 批量添加机构角色菜单
     *
     * @param groupId       the group id
     * @param roleId        the group id
     * @param menuIdList    the menu id list
     *
     * @return the int.
     */
    Integer batchSaveRoleMenu(@Param("groupId") Long groupId,
                              @Param("roleId") Long roleId,
                              @Param("menuIdList") List<Long> menuIdList);

    /**
     * 查询机构角色选中的菜单Id列表
     *
     * @param groupRoleDto the group role dto
     *
     * @return the list.
     */
    List<Long> getCheckedMenuList(GroupRoleDto groupRoleDto);

    /**
     * 批量删除机构角色菜单
     *
     * @param groupId       the group id
     * @param roleId        the role id
     * @param menuIdList    the menu id list
     *
     * @return  the int.
     */
    Integer batchDeleteRoleMenu(@Param("groupId") Long groupId,
                                @Param("roleId") Long roleId,
                                @Param("menuIdList") List<Long> menuIdList);

    /**
     * query menu and sub menu list with page
     *
     * @param groupMenuQueryDto the group menu query dto
     *
     * @return  the list.
     */
    List<UacMenu> queryMenuAndSubMenuListWithPage(GroupMenuQueryDto groupMenuQueryDto);

    /**
     * query role menu list with page
     *
     * @param groupMenuQueryDto the group menu query dto
     *
     * @return  the list.
     */
    List<UacMenu> queryRoleMenuListWithPage(GroupMenuQueryDto groupMenuQueryDto);

    /**
     * 查询角色-菜单数量
     *
     * @param roleId     the role id
     * @param menuIdList the menu id list
     *
     * @return the int.
     */
    int selectCountRoleIdAndMenuIdList(@Param("roleId") Long roleId,
                                       @Param("menuIdList") List<Long> menuIdList);

    /**
     * query menu list by group id and user id
     *
     * @param groupId   the group id
     * @param userId    the user id
     *
     * @return the list.
     */
    List<MenuVo> queryMenuListByGroupIdAndUserId(@Param("groupId") Long groupId,
                                                 @Param("userId")Long userId);
}